#include <math.h>
#include <stdio.h>
#include <stdlib.h>

#define PI 3.1415926536
#define LOG2N 8

int main () {
  int N = (int)pow(2,LOG2N);
  int kmax = N / 2;
  double **cks;
  double **sks;
  
  cks = new double*[kmax];
  sks = new double*[kmax];
  
  for ( int k = 0; k <= kmax; k++ ) {
    cks[k] = new double [N];
    sks[k] = new double [N];
    for ( int i = 0; i < N-1; i++ ) {
      cks[k][i] = cos( 2 * PI * k * i / N );
      sks[k][i] = sin( 2 * PI * k * i / N );
    }
  }
  
  for ( int k = 0; k <= kmax; k++ ) {
    for ( int i = 0; i < N-1; i++ ) {
      printf( "%.6f\n",cks[k][i] );
    }
  }
  
  for ( int k = 0; k <= kmax; k++ ) {
    for ( int i = 0; i < N-1; i++ ) {
      printf( "%.6f\n",sks[k][i] );
    }
  }
  
  
  for ( int k = 0; k <= kmax; k++ ) {
    delete []cks[k];
  }
  delete []cks;
  for ( int k = 0; k <= kmax; k++ ) {
    delete []sks[k];
  }
  delete []sks;



  return 1;
}
